package org.elec.mac.service;

import org.elec.mac.entity.SSale;
import org.elec.mac.mapper.SSaleMapper;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.sql.SQLException;

/**
 * @Description: 逻辑层接口
 * @author 
 * @version 1.0
 * @created 
 */
@Service
public class SSaleService extends BaseService<SSale, SSaleMapper> implements InitializingBean {

    @Autowired
    private SSaleMapper sSaleMapper;

    public void afterPropertiesSet() throws Exception {
        this.setBaseMapper(sSaleMapper);
    }

    /**
     *
     * @param sSale
     * @throws SQLException
     */
    @Transactional(rollbackFor = SQLException.class)
    public void insertSaleProduct(SSale sSale) throws SQLException {
        sSaleMapper.insert(sSale);
    }

    /**
     *
     * @param sSale
     * @return
     * @throws SQLException
     */
    @Transactional(rollbackFor = SQLException.class)
    public int updateSaleProduct(SSale sSale) throws SQLException {
        return sSaleMapper.update(sSale);
    }

}